 <?php
class CommunityHelper extends AppHelper
{
    var $helpers = array('Html');

    function menu($links = array(),$htmlAttributes = array(),$type = 'ul')
    {
        $this->tags['ul'] = '<ul%s>%s</ul>';
        $this->tags['ol'] = '<ol%s>%s</ol>';
        $this->tags['li'] = '<li%s>%s</li>';
        $out = array();
        foreach ($links as $title => $link)
        {
            if($this->url($link) == substr($this->here,0,-1))
            {
                $out[] = sprintf($this->tags['li'],' class="active"',$this->Html->link($title, $link));
            }
            else
            {
                $out[] = sprintf($this->tags['li'],'',$this->Html->link($title, $link));
            }
        }
        $tmp = join("\n", $out);
        return $this->output(sprintf($this->tags[$type],$this->_parseAttributes($htmlAttributes), $tmp));
    }
}
?> 